package cn.tedu;

import cn.tedu.mapper.StudentMapper;
import cn.tedu.pojo.Student;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

@SpringBootTest
public class TeatResultMap {
   @Autowired
    private StudentMapper studentMapper;

    @Test
    public void testGetstudentAll() {
        String minBirth = "2015-06-01";
        String maxBirth = "2015-07-30";
       List<Student> lists = studentMapper.selectListByBirth(minBirth, maxBirth);
        for (Student student : lists){
            System.out.println(student);
        }
    }

    @Test
    public void testGetStudentByIds(){
        Integer[] ids = {497,498,499,500};
        int count = studentMapper.deleteStudentByIds(ids);
        System.out.println(count);
    }

    @Test
    public void testUpdateStudentById(){
        Student student = new Student();
        student.setId(501);
        student.setName("小红");
        student.setAge(18);
        student.setGender("女");
        student.setJob("学生");
        int count = studentMapper.updateStudentById(student);
        System.out.println(count>0?"修改成功":"修改失败");
    }
}
